package com.example.gulimall.cas.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.gulimall.cas.model.RoleDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * <p>@description: 角色DAO  </p>
 * <p>@author: JGD </p>
 * <p>@create: 2020/4/20 9:46 </p>
 * <p>@version : 2.0.0
 **/
@Mapper
@Repository
public interface RoleDAO extends BaseMapper<RoleDO> {
    /**
     * 获取当前用户的所有角色
     * @param id 用户Id
     * @return List<RoleDO>
     */
    @Select("select * from tb_user_role as a left join tb_role as b on a.role_id = b.id  where a.user_id = #{id}")
    List<RoleDO> selectByUserId(@Param("id") Integer id);
}
